c<?php

require_once('Adept/Converter/IConverter.php');

class Adept_Converter_DateTime implements Adept_Converter_IConverter {

    protected $format = '%d.%m.%Y';

    public function getAsModel($value) {
        $dateTime = new Adept_DateTime();
        
        if (preg_match('~(\d+)\.(\d+)\.(\d+)~', $value, $match)) {
            $dateTime->setDay($match[1]);
            $dateTime->setMonth($match[2]);
            $dateTime->setYear($match[3]);
        }

        return $dateTime;
    }

    public function getAsString($value) {
        $dateTime = new Adept_DateTime($value);
        return $dateTime->format($this->format);
    }

    public function getFormat() 
     {
         return $this->format;
     }
     
     public function setFormat($name2) 
     {
         $this->name2 = $name2;
     } 
   
}

